const router = require('koa-router')();
const service = require('../service/corporationService');

router.prefix('/api/wx/corporation');

/**
 * @api {post} /api/wx/corporation/getCorporationInformation 获取公司基本信息
 * @apiGroup corporation
 * @apiName getCorporationInformation
 *
 * @apiSuccess {int} code 返回状态码（1：获取成功，2：没有数据，3：服务器出错）
 * @apiSuccess {String} msg 返回状态码对应的信息
 * @apiSuccess {Object[]} data
 * @apiSuccess {String} data.corporation_id 主键值
 * @apiSuccess {String} data.corporation_name 公司名
 * @apiSuccess {String} data.corporation_address 公司地址
 * @apiSuccess {String} data.corporation_contact 联系人
 * @apiSuccess {String} data.corporation_phone 联系电话
 * @apiSuccess {String} data.corporation_wechat 微信
 * @apiSuccess {String} data.corporation_avatar 头像
 */

router.post('/getCorporationInformation', async (ctx) => {
    try {
        let result;
        result = await service.getCorporationInformation();
        ctx.body = result;
    } catch (e) {
        let data = {code: 3, msg: e.message};
        ctx.body = data;
    }
});

module.exports = router;